<?php
//define("Page", "Index");
include $_SERVER["DOCUMENT_ROOT"] . "/view/head.php";
$PAGE_NAME = "index";
$products = $cms->products();
$about = $cms->about();
$comp_news = $cms->news("news");
$profession_news = $cms->news("profession");
$technology_news = $cms->news("technology");
include $_SERVER["DOCUMENT_ROOT"] . "/view/banner.php";
?>
<?php
//推荐产品
if (!empty($products)) { ?>
    <div class="container">
        <div class="ct_title">
            <h3 class="animate__animated animate__backInUp" data-wow-delay=".1s"
                style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">产品中心
                <span>PRODUCT CENTER</span></h3>
            <p></p>
        </div>
        <div class="clf product_div">
            <ul>
                <?php foreach ($products as $key => $val) { ?>
                    <li class="animate__animated animate__backInUp" data-wow-delay="0.<?php echo $key ?>s"
                        style="visibility: visible; animation-delay: 0.<?php echo $key ?>s; animation-name: fadeInUp;">
                        <a href="/<?php echo $basepath . "/" . ($cms->is_html ? "product/product" . $val['idProduct'] . ".html" : "view/product_detail.php?&detail_id=" . $val['idProduct'] . "&type=product&id=" . $val["idDataCategory"]) ?>">
                            <div class="img">
                                <img src="/<?php echo $basepath ?>/assert/images/hangye.jpg"></div>
                            <div class="text">
                                <div class="box">
                                    <h3><?php echo $val["productName"] ?></h3>
                                    <p><?php echo substr($val["productDesc"], 0, 200) ?></p>
                                    <span class="btn">详情</span></div>
                            </div>
                        </a>
                    </li>
                <?php } ?>
            </ul>
        </div>
    </div>
<?php } ?>
<?php
//关于我们
if (!empty($about)) { ?>
    <div class="container">
        <div class="ct_title">
            <h3 class="animate__animated animate__backInUp" data-wow-delay=".1s"
                style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">关于我们
                <span>ABOUT US</span></h3>
            <p></p>
        </div>
        <div class="clf about">
            <div class="index_about" style="visibility: visible;">
                <div class="about_content animate__animated animate__backInUp wow" data-wow-delay=".1s"
                     style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">
                    <?php echo substr($about["content"], 0, 1000); ?>
                </div>
                <div class="btn">
                    <a href="/<?php echo $basepath . "/" . ($cms->is_html ? "page/page" . $about["idPages"] . ".html" : "view/page.php?pid=" . $about["idDataCategory"] . "&id=" . $about["idPages"]) ?>">详情</a>
                </div>
            </div>
            <div class="about_img" style="visibility: visible">
                <img src="/<?php echo $basepath ?>/assert/images/about1.jpg"></div>
        </div>
    </div>
<?php } ?>

<?php
//公司新闻,技术咨询,行业新闻,如果三者都没有数据,则隐藏新闻标题
if (!empty($comp_news["dataList"]) || !empty($profession_news["dataList"]) || !empty($technology_news["dataList"])) {
    ?>
    <div class="container">
        <div class="ct_title">
            <h3 class="animate__animated animate__backInUp" data-wow-delay=".1s"
                style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">新闻资讯
                <span>NEWS</span></h3>
            <p></p>
        </div>
        <div class="clf news animate__animated animate__backInUp wow" data-wow-delay=".1s"
             style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">
            <?php if (!empty($comp_news) && !empty($comp_news["dataList"])) { ?>
                <figure class="col-xs-12 col-sm-6 col-md-6 col-lg-4 news_r">
                    <h5 class="news_tit">公司新闻</h5>
                    <div class="ns1" style="visibility: visible; animation-delay: 0.1s; animation-name: fadeInUp;">
                        <dl>
                            <?php foreach ($comp_news["dataList"] as $key => $val) {
                                $dt = new DateTime($val["createdDate"]);
                                ?>
                                <dd class="clf animate__animated animate__backInRight "
                                    data-wow-delay=".<?php echo $key ?>s"
                                    style="visibility: visible; animation-delay: 0.<?php echo $key ?>s; animation-name: fadeInUp;">
                                    <div class="fl ns1_lt">
                                        <h5><?php echo $dt->format("d"); ?></h5>
                                        <span><?php echo $dt->format("Y-m"); ?></span></div>
                                    <div class="fl ns1_rt">
                                        <h5><a class="praas"
                                               href="/<?php echo $basepath . "/" . ($cms->is_html ? "news/news" . $val["idNews"] . ".html" : "view/news_detail.php?pid=" . $val["idDataCategory"] . "&id=" . $val["idNews"]) ?>"><?php echo substr($val["title"], 0, 80) ?></a>
                                        </h5>
                                        <p class="description"><a class="praas"
                                                                  href="/<?php echo $basepath . "/" . ($cms->is_html ? "news/news" . $val["idNews"] . ".html" : "view/news_detail.php?pid=" . $val["idDataCategory"] . "&id=" . $val["idNews"]) ?>"
                                                                  style="font-size: 14px; color:#888"><?php echo substr($val["content"], 0, 80) ?></a>
                                        </p>
                                    </div>
                                </dd>
                            <?php } ?>

                        </dl>
                    </div>
                </figure>
            <?php } ?>
            <?php
            if (!empty($profession_news) && !empty($profession_news["dataList"])) { ?>
                <figure class="col-xs-12 col-sm-6 col-md-6 col-lg-4 news_r2  animate__animated animate__backInUp">
                    <h5 class="news_tit">行业动态</h5>
                    <div class="ns2 wow">
                        <p><img src="/<?php echo $basepath ?>/assert/images/hangye.jpg" alt=""></p>
                        <dl>
                            <?php foreach ($profession_news["dataList"] as $key => $val) {
                                $dt = new DateTime($val["createdDate"]);
                                ?>
                                <dd class="clf animate__animated animate__backInUp"
                                    data-wow-delay=".<?php echo $key ?>s"
                                    style="visibility: visible; animation-delay: 0.<?php echo $key ?>s; animation-name: fadeInUp;">
                                    <i class="fa fa-gg"></i><a
                                            class="praas"
                                            href="/<?php echo $basepath . "/" . ($cms->is_html ? "news/news" . $val["idNews"] . ".html" : "view/news_detail.php?pid=" . $val["idDataCategory"] . "&id=" . $val["idNews"]) ?>"
                                            title="<?php echo $val["title"] ?>"><?php echo $val["title"] ?></a><span><?php echo $dt->format("Y-m-d") ?></span>
                                </dd>
                            <?php } ?>
                        </dl>
                    </div>
                </figure>
            <?php } ?>
            <?php if (!empty($technology_news) && !empty($technology_news["dataList"])) { ?>
                <figure class="col-xs-12 col-sm-6 col-md-6 col-lg-4 news_r3  animate__animated animate__backInUp">
                    <h5 class="news_tit">技术资讯</h5>
                    <div class="ns2 wow" style="margin-bottom:60px;">
                        <p><img src="/<?php echo $basepath ?>/assert/images/jishu.jpg" alt=""></p>
                        <dl>
                            <?php foreach ($technology_news["dataList"] as $key => $val) {
                                $dt = new DateTime($val["createdDate"]);
                                ?>
                                <dd class="clf animate__animated animate__backInUp"
                                    data-wow-delay=".<?php echo $key ?>s"
                                    style="visibility: visible; animation-delay: 0.<?php echo $key ?>s; animation-name: fadeInUp;"
                                ><i class="fa fa-gg"></i><a
                                            class="praas"
                                            href="/<?php echo $basepath . "/" . ($cms->is_html ? "news/news" . $val["idNews"] . ".html" : "view/news_detail.php?pid=" . $val["idDataCategory"] . "&id=" . $val["idNews"]) ?>"
                                            title="<?php echo $val["title"] ?>"><?php echo $val["title"] ?></a><span><?php echo $dt->format("Y-m-d") ?></span>
                                </dd>
                            <?php } ?>

                        </dl>
                    </div>
                </figure>
            <?php } ?>
        </div>
    </div>
<?php } ?>
<?php if ($cms->is_html) { ?>
    <script type="text/javascript" src="/<?php echo $basepath ?>/assert/js/click_record.js"></script>
    <script type="text/javascript">
       $(function () {
           let id=<?php echo $head["idSystemconfig"]?>;
           //页面点击次数记录
           clickRecord.indexClick(id);
       });
    </script>
<?php } ?>
<?php include $_SERVER["DOCUMENT_ROOT"] . "/view/footer.php"; ?>
